//package com.cuit.ocp.common.interceptors;
//
//import com.alibaba.druid.util.StringUtils;
//import com.cuit.ocp.bean.Trader;
//import com.cuit.ocp.common.exception.CustomException;
//import com.cuit.ocp.dao.TraderDao;
//import com.cuit.ocp.service.TraderService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.HandlerInterceptor;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * @description:权限检测
// * @time: 2020/12/27 19:15
// */
//@Component
//public class LoginInterceptor implements HandlerInterceptor {
//
//
//    public LoginInterceptor() {
//        super();
//    }
//
//    @Autowired
//    private TraderService traderService;
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        String username = request.getParameter("tradername");
//        String password = request.getParameter("password");
//        Trader trader = traderService.findByName(username);
//        if (traderService.findByName(username) == null || trader.getPassword() != password) {
//            throw new CustomException("401", "无权限！需登录");
//        } else
//            return true;//放行
//        }
//    }
